package com.xsr.exeception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author 邢式瑞
 * @version 1.0
 * @project springMvcday03
 * @date 2022/9/13 10:11
 */

 @ControllerAdvice
public class Myexception {

     @ExceptionHandler
    public ModelAndView exception(Exception e){
         System.out.println(e);
         ModelAndView modelAndView = new ModelAndView();
         modelAndView.setViewName("/error");
         modelAndView.addObject("e",e);
         return modelAndView;

     }
}
